<title>ResourceLoadPriority tests</title>

<script src="resources/common.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script>
window.onmessage = function(message) {
  if (message.data.hasOwnProperty('Priority')) {
    window.onRequestPriorityUpdated(message.data['Priority']);
  }
  if (message.data.hasOwnProperty('Status')) {
    window.onRequestStatusChanged(message.data['Status']);
  }
}

resource_load_priority_test(
  'off-screen-image.html', kLow,
  'Off-screen images should be loaded with kLow priority');

resource_load_priority_test(
  'render-blocking-stylesheet.html', kVeryHigh,
  'Render-blocking style sheets should be loaded with kVeryHigh priority');

resource_load_priority_test(
  'parser-blocking-script.html', kHigh,
  'Parser-blocking scripts should be loaded with kHigh priority');

resource_load_priority_test(
  'async-script.html', kHigh,
  'Async scripts should be loaded with kLow priority');

resource_load_priority_test(
  'defer-script.html', kHigh,
  'Deferred scripts should be loaded with kLow priority');

resource_load_priority_test(
  'module-script.html', kHigh,
  'Module scripts should be loaded with kHigh priority');

resource_load_priority_test(
  'fetch.html', kHigh,
  'Requests from the Fetch API should be loaded with kHigh priority');

resource_load_priority_test(
  'xhr.html', kHigh, 'XHRs should be loaded with kHigh priority');

resource_load_priority_test(
  'sync-xhr.html', kVeryHigh,
  'Synchronous XHRs should be loaded with kVeryHigh priority');

// Preload tests.
resource_load_priority_test(
  'preload/as-style.html', kVeryHigh,
  'Preloaded style sheets should be loaded with kVeryHigh priority');

resource_load_priority_test(
  'preload/as-script.html', kHigh,
  'Preloaded scripts should be loaded with kHigh priority');

resource_load_priority_test(
  'preload/as-font.html', kHigh,
  'Preloaded fonts should be loaded with kHigh priority');

resource_load_priority_test(
  'preload/as-fetch.html', kHigh,
  'Preloaded fetches should be loaded with kHigh priority');

resource_load_priority_test(
  'preload/as-image.html', kLow,
  'Preloaded images should be loaded with kLow priority');
</script>
